package com.vehicle.mapper;

import com.github.pagehelper.Page;
import com.vehicle.pojo.Cars;
import com.vehicle.pojo.DTO.VehicleQueryDTO;
import com.vehicle.pojo.VO.VehicleQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;



@Mapper
public interface CarMapper {

    /**
     * 分页查询
     * @param vehicleQueryDTO
     * @return
     */
    Page<VehicleQueryVO> pageQuery(VehicleQueryDTO vehicleQueryDTO);

    /**
     * 通过Id查询车辆详细信息
     * @param id
     * @return
     */
    @Select("select * from cars where id =#{id}")
    Cars selectById(Long id);

    /**
     * 查询车辆品牌
     * @param brandKey
     * @return
     */
    boolean selectBrandKey(String brandKey);

    /**
     * 新增车辆
     * @param cars
     */
    void add(Cars cars);

    /**
     * 更新车辆信息
     * @param cars
     */
    void update(Cars cars);

    /**
     * 根据车名查看车辆信息
     * @param carsName
     * @return
     */
    Cars selectByName(String carsName);

    /**
     * 查询库存
     * @param carsName
     * @return
     */
    @Select("select inventory from cars where name =#{carsName}")
    Long selectInventory(String carsName);

    /*    *//**
     * 通过Id查询车辆品牌
     * @param id
     * @return
     *//*
    @Select("select brand from brands where id = #{id}")
    String selectBrandById(String id);*/
}
